package com.lagou.service;

import com.lagou.domain.Tarticle;
import com.lagou.repository.TarticleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.thymeleaf.expression.Lists;

import java.util.ArrayList;

/**
 * Created by shixi  on 2020/10/15
 */
@Service
public class TarticleServiceImpl {

    @Autowired
    private TarticleRepository tarticleRepository;

    public Page<Tarticle> pages(int pageNum, int pageSize){
        PageRequest pageable = PageRequest.of(pageNum, pageSize, Sort.Direction.DESC,"id");
        return tarticleRepository.findAll(pageable);
    }
}
